<?php
#
# author: Cody Sorgenfrey
# (c)2012 South Hill Calvary Chapel
#

include_once("../mysql/database_info.php");
include_once("common.php");
include_once("../mysql/common.php");

$title = "Bible in a Year"; 
$meta_key='Bible, reading, one, 1, year, plan, daily, scripture, annually, annual';
$meta_desc="A plan to read through the Bible in one year.";
$morehtml= NULL;
$morejava= NULL;

connect_select_test("Bible1YearNew");

startPage($title, $meta_key, $meta_desc, $morehtml, $morejava);

printf("<h4>Today's Reading is:</h4>\n");

$todaysResult = mysql_query("SELECT * FROM `Bible1YearNew` WHERE `date` LIKE '%".date("m-d", strtotime("today"))."' ORDER BY `date` ASC");

$todaysRow = mysql_fetch_array($todaysResult);

printf("<table style='width:%s;'><tr><th>Date</th><th>New Testament</th><th>Old Testament</th></tr>", "100%");

printf("<tr class='dotted_lines row_even'><td style='text-align:center;'>%s</td><td style='text-align:center;'><a href='http://www.blueletterbible.org/search/preSearch.cfm?Criteria=%s&amp;t=NKJV'>%s</a></td><td style='text-align:center;'><a href='http://www.blueletterbible.org/search/preSearch.cfm?Criteria=%s&amp;t=NKJV'>%s</a></td></tr>\n", date("M d", strtotime($todaysRow['date'])), urldecode($todaysRow['NT']), $todaysRow['NT'], urldecode($todaysRow['OT']), $todaysRow['OT']);

printf("</table></div>");

printf("<div class='pagecontent'><h4>Archive:</h4>\n");

printf("<table style='width:%s;'><tr><th>Date</th><th>New Testament</th><th>Old Testament</th></tr>", "100%");

$result = mysql_query("SELECT * FROM `Bible1YearNew` ORDER BY `date` ASC");

while ($row = mysql_fetch_array($result)){
	
	if ($i == 1){	
		printf("<tr class='dotted_lines row_odd'><td style='text-align:center;'>%s</td><td style='text-align:center;'><a href='http://www.blueletterbible.org/search/preSearch.cfm?Criteria=%s&amp;t=NKJV'>%s</a></td><td style='text-align:center;'><a href='http://www.blueletterbible.org/search/preSearch.cfm?Criteria=%s&amp;t=NKJV'>%s</a></td></tr>\n",date("M d", strtotime($row['date'])), urldecode($row['NT']), $row['NT'], urldecode($row['OT']), $row['OT']);
		$i = 0;
	}
	else{	
		printf("<tr class='dotted_lines row_even'><td style='text-align:center;'>%s</td><td style='text-align:center;'><a href='http://www.blueletterbible.org/search/preSearch.cfm?Criteria=%s&amp;t=NKJV'>%s</a></td><td style='text-align:center;'><a href='http://www.blueletterbible.org/search/preSearch.cfm?Criteria=%s&amp;t=NKJV'>%s</a></td></tr>\n", date("M d", strtotime($row['date'])), urlencode($row['NT']) ,$row['NT'], urldecode($row['OT']), $row['OT']);
		$i = 1;
	}
}

printf("</table>");
endPage();

?>